package com.dalao.root.login.controller;

import com.dalao.root.login.entity.LoginUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("login")
public class LoginController {

    /**
     * 进入登录页面
     *
     * @return
     */
    @RequestMapping("welcome")
    public String welcome() {
        return "login";
    }

    /**
     * 登入
     *
     * @return
     */
    @RequestMapping("signIn")
    public String signIn(LoginUser loginUser, HttpSession session) {
        session.setAttribute("loginUser", loginUser);
        System.out.println(loginUser);
        return "redirect:/system/view/main";
    }

    /**
     * 登出
     *
     * @return
     */
    @RequestMapping("signOut")
    public String signOut() {
        return "login";
    }

}
